<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        li{
            list-style: none;
            float: left;
        }
        #watched{
            width: 450px;
            height: 150px;
            margin: 100px auto;
            position: relative;
            overflow: hidden;
            border: 1px solid black;
        }
        #gallery{
            position: absolute;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <div id="roll">
        <div id="watched">
            <ul id="gallery">
                <li>
                    <img src="./images/001.webp" alt="">
                </li>
                <li>
                    <img src="./images/002.webp" alt="">
                </li>
                <li>
                    <img src="./images/003.webp" alt="">
                </li>
                <li>
                    <img src="./images/004.webp" alt="">
                </li>
                <li>
                    <img src="./images/005.webp" alt="">
                </li>
                <li>
                    <img src="./images/006.webp" alt="">
                </li>
                <li>
                    <img src="./images/007.webp" alt="">
                </li>
                <li>
                    <img src="./images/008.webp" alt="">
                </li>
                <li>
                    <img src="./images/009.webp" alt="">
                </li>
                <li>
                    <img src="./images/010.webp" alt="">
                </li>
                <li>
                    <img src="./images/001.webp" alt="">
                </li>
                <li>
                    <img src="./images/002.webp" alt="">
                </li>
                <li>
                    <img src="./images/003.webp" alt="">
                </li>
            </ul>
        </div>
    </div>
</body>
</html>
<script>
    class Picrun{
        constructor(){
            this.gallery = this.$('gallery')
            this.imgs = this.gallery.children
            this.width = 150
            this.widths = this.width*this.imgs.length   
            this.gallery.style.width = this.widths + 'px'    
            this.step = 1    
            this.run()
        }
        $ = id => document.getElementById(id)

        // 跑起来
        run(){
            let firstStep = 0
            setInterval(()=>{
                firstStep -= this.step               
                if (firstStep == -1500) {
                    firstStep = 0
                }
                this.gallery.style.left = firstStep + 'px'
            },5)
        }
    }
    new Picrun


</script>